<html>
	<!-- checks if there are no interests on the system yet-->
	<% if @all_interests == nil || @all_interests == [] %>
	<div align="center">
		 <font face="Courier New, Courier, monospace" COLOR="FF0000" size="3">
		 <b>No interests on the system yet!!</b></font></br>		 
		</div>
  	<%else%>

  <div align="center">
     <font face="Courier New, Courier, monospace" size="3"><b>Interests</b></font></br>
     <span class="greenbadge"><%="Added"%></span> 
     <span class="redbadge"><%="Deleted"%></span>  
     <span class="yellowbadge"><%="Blocked"%></span>
     <br><br><br>
<!-- create button each interest in the system and if this interest already exists in user interests it makes the button green else it make it red and if interest is blocked by user before the word "(blocked)" is displayed next to the interest -->
<!-- on adding new/blocked interest the page is refreshed and buttin color is changed into green
on deleting an exsiting interest the page is refreshed and button color is changed into red -->
   
      
   	<% @all_types.each do |t| %>
   	<table style="float:left">
					<tr>
						<% if current_user.check_group(t) == true %>
						<td><span><%= link_to "#{t}", {:controller => 'users', :action => 'toggle_group',:name => t } ,class: "pull-left greenbadge" %></span></td>
						<%else%>
						<td><span><%= link_to "#{t}", {:controller => 'users', :action => 'toggle_group',:name => t } ,class: "pull-left redbadge" %></span></td>
						<%end%>
					</tr>
				</table><br>
   	<div class="well">
   	<% Interest.get_interests(t).each do |interest| %>
		<!-- Kareem -->
   	   <div class="welllo">
		<table>			
   <%if (@user_interests.include? interest) && (@user.blocked_interests.include? interest) %> 		 			
	
	<span><%= link_to interest.name.upcase, {:controller => 'interests', :action => 'mob',:id => interest.id } ,class: "yellowbadge" %></span><br>
	<%else%>
		<% if @user.added_interests.include? interest %>
		
			<span><%= link_to interest.name.upcase, {:controller => 'interests', :action => 'mob',:id => interest.id } ,class: "greenbadge" %></span><br>	
		<%else%>	
	   		
	   		<span><%= link_to interest.name.upcase, {:controller => 'interests', :action => 'mob',:id => interest.id } ,class: "redbadge" %></span><br>
	        <%end%>
   <%end%>
		</table><br>
			<table>


		<%if @user_interests.include? interest%> 		 	
			<td><span><%= link_to 'Delete', 
{:controller => 'users', :action => 'int_toggle',:id => interest.id }, 
class: "btn btn-danger" %></span></td>
		<%else%>
   		  	            <td><span><%= link_to 'Add', 
{:controller => 'users', :action => 'int_toggle', :id => interest.id }, 
class: "btn btn-success"%></span></td>
			
			
		<%end%>

		 
	<%if @user.blocked_interests.include? interest %>	  
		<td><span><%= link_to 'Unblock', 
{:controller => 'users', :action => 'unblock_interest_from_toggle', :id => (interest.id)} , 
class: "btn btn-warning"%></span> </td>
	<%else%>
	 	<td><span><%= link_to 'Block', 
{:controller => 'users', :action => 'block_interest_from_toggle', :id => (interest.id)} , 
class: "btn btn-warning"%></span></td>
		<td><span><%= link_to "Feed", 
	{:controller => "users", :action => "feed", :interest => interest.name}, 
	class: "btn btn-info" %></span></td>
	<%end%>	
		
	</table>
	</div>
	
	<%end%> 
   </div>
   	<%end%> 
	</div>
	<!-- added main feed button on click goes to main feed  -->
		<div align="center" >
			<%= link_to ' Main feed' , {:controller => 'users', :action => 'feed'} , 
class: "btn" %></br>
		</div>
  </div>
  <%end%>	
</html>
